package com.jiang.controller;

import com.jiang.service.AAA;
import com.jiang.utils.BaseController;
import com.jiang.utils.JwtUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import com.jiang.entity.Admin;
import com.jiang.service.AdminService;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/jiang/Admin")
public class AdminController extends BaseController {
	@Autowired
	private AdminService adminService;
	@Autowired
	private AAA aaa;

	@RequestMapping("/show")
	@ResponseBody
	public List<Map<String,Object>> show(){
		return adminService.show();
	}
	@RequestMapping("/login")
	@ResponseBody
	public String login(String account,String password){
		Admin map=adminService.login(account,password);
		if(map==null){
			return "error";
		}
		//success
		String token= JwtUtils.getToken(map,3600000);
		return token;
	}

	@RequestMapping("/aop")
	@ResponseBody
	public String aop(){
		aaa.m1();
		return "111";
	}


}